<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
    <title>Wifi Switch</title>
    <link href="__CSS__/bootstrap.css" rel="stylesheet" type="text/css" />
    <link href="__CSS__/font-awesome.css" rel="stylesheet" type="text/css" />
    <link href="__SWITCH__/css/switch.css" rel="stylesheet" type="text/css"/>
    <style>
        .topmargin{
            margin-top: 10px;
            margin-bottom: 20px;
            text-align: center;
        }
        #basic-addon1,#basic-addon2,#basic-addon3,#basic-addon4,#basic-addon5,#basic-addon6,#basic-addon7,#basic-addon8{
             background-color: #337ab7;
            color: white;
         }
    </style>
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top" style="background-color: #337ab7">
    <div class="container">
        <h2 style="color: white">WifiSwitch</h2>
    </div>
</nav>
<div class="container" style="margin-top: 60px;">
    <div class="row">
        <div class="col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2 col-xs-12 topmargin">
            <div class="input-group input-group-lg">
                <span class="input-group-addon " id="basic-addon1">设备&nbsp;&nbsp;&nbsp;&nbsp;Id</span>
                <input type="text" class="form-control" placeholder="设备Id" aria-describedby="basic-addon1">
            </div>
        </div>
        <div class="col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2 col-xs-12 topmargin">
            <div class="input-group input-group-lg">
                <span class="input-group-addon " id="basic-addon2">芯片&nbsp;&nbsp;&nbsp;&nbsp;Id</span>
                <input type="text" class="form-control" placeholder="芯片Id" aria-describedby="basic-addon1">
            </div>
        </div>
        <div class="col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2 col-xs-12 topmargin">
            <div class="input-group input-group-lg">
                <span class="input-group-addon " id="basic-addon3">设备类型</span>
                <input type="text" class="form-control" placeholder="设备类型" aria-describedby="basic-addon1">
            </div>
        </div>
        <div class="col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2 col-xs-12 topmargin">
            <div class="input-group input-group-lg">
                <span class="input-group-addon " id="basic-addon4">设备归属</span>
                <input type="text" class="form-control" placeholder="设备归属" aria-describedby="basic-addon1">
            </div>
        </div>
        <div class="col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2 col-xs-12 topmargin">
            <div class="input-group input-group-lg">
                <span class="input-group-addon " id="basic-addon5">区域编号</span>
                <input type="text" class="form-control" placeholder="区域编号" aria-describedby="basic-addon1">
            </div>
        </div>
        <div class="col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2 col-xs-12 topmargin">
            <div class="input-group input-group-lg">
                <span class="input-group-addon " id="basic-addon6">楼宇编号</span>
                <input type="text" class="form-control" placeholder="楼宇编号" aria-describedby="basic-addon1">
            </div>
        </div>
        <div class="col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2 col-xs-12 topmargin">
            <div class="input-group input-group-lg">
                <span class="input-group-addon " id="basic-addon7">设备地址</span>
                <input type="text" class="form-control" placeholder="设备地址" aria-describedby="basic-addon1">
            </div>
        </div>
        <div class="col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2 col-xs-12 topmargin">
            <div class="input-group input-group-lg">
                <span class="input-group-addon " id="basic-addon8">设备别名</span>
                <input type="text" class="form-control" placeholder="设备别名" aria-describedby="basic-addon1">
            </div>
        </div>
        <div class="col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2 col-xs-12 topmargin">
            <button type="button" class="btn btn-primary col-md-12 col-sm-12 col-xs-12">提  交</button>
        </div>
    </div>
</div>

<div class="panel panel-primary" style="margin-top: 100px;">
    <div class="panel-body">
        <p align="center">
            Copyright © 2017.HengChuang Team All rights reserved.Powered by
            <a href="http://115.159.151.135/" target="_blank" title="Xwen">Xwen</a>
        </p>
        <p align="center" style="color: #337ab7">指导老师：罗回彬&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;成员：卢学文&nbsp;&nbsp;黄嘉爔</p>
    </div>
</div>



</body>
</html>
<script src="__JS__/jquery-3.2.1.min.js" type="text/javascript"></script>
<script src="__JS__/bootstrap.js" type="text/javascript"></script>
<script>
    $(document).ready(function(){
        setInterval(function(){
            $.ajax({
                type: "POST",
//                url: "{:U('Index/indexRefresh')}",
                dataType: "json",
                success: function(data){
                    var deviceData = eval("("+data+")");

                    console.log("Ajax successful! deviceData: "+deviceData.length);
                    console.log(deviceData);
                }
            })
        },10000);
    })
    function sendCommand(switchName){
        var box = document.getElementById(switchName);
        if(box.checked){
            $.ajax({
                type: "POST",
                url: "../../../Console.php?id="+switchName+"&f=0",
                data: {led:"SWITCH1"},
            });
        }else{
            $.ajax({
                type: "POST",
                url: "../../../Console.php?id="+switchName+"&f=0",
                data: {led:"SWITCH0"},
            });
        }
    }

</script>